package com.hss.recyclerviewtest.itemtouch;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hss.recyclerviewtest.R;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class MyAdapter extends BaseQuickAdapter<String ,BaseViewHolder> implements ItemTouchHelperAdapter{


    public MyAdapter() {
        super(R.layout.item_msg, null);

    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.tv_subtitle,item==null?"":item);

    }

    @Override
    public void onItemMove(int fromPosition, int toPosition) {
        Collections.swap(getData(),fromPosition,toPosition);
        notifyItemMoved(fromPosition,toPosition);
    }

    @Override
    public void onItemDissmiss(int position) {
            remove(position);
//            notifyItemRemoved(position);
    }
}
